package com.qiong.algorithm;

/**
 * @Author: Liqc
 * @Date: 2022/9/9 13:00
 */
public class PalindromeNumber {

    public static void main(String[] args) {
        isPalindrome1(10);
    }

    public static boolean isPalindrome1(int x) {
        if (x < 0) return false;
        char[] chars = (x + "").toCharArray();
        String palindrome = "";
        for (int i = chars.length - 1; i >= 0; i--) {
            palindrome += chars[i];
        }
        return palindrome.equals(x + "");
    }

    /**
     * 把后半部分的数字转换成一下和前半部分比即可
     * @param x
     * @return
     */
    public static boolean isPalindrome2(int x) {
        return false;
    }

}
